home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / batch / tsbat36.zip / APATH-OM.BAT < prev    next >
DOS Batch File  |  1990-01-13  |  2KB  |  47 lines

  1. ECHO OFF
  2. REM Add directory names to current path
  3. REM Written in 1990 by Otto Makela, Jyvaskyla, Finland
  4.  
  5. REM Included in my (Timo Salmi's) batch file collection with Otto's
  6. REM explicit permission. Thanks Otto. This batch nicely demonstrates
  7. REM testing a condition (is a directory already in the path) in MsDos
  8. REM batch programming. I had an interesting time testing Otto's batch
  9. REM and discussing the dilemmas in the earlier versions after Otto
  10. REM posted the original version in alt.msdos.programmer. I think that
  11. REM we both gained in the process.
  12.  
  13. REM From: otto@jyu.fi (Otto J. Makela)
  14. REM Subject: Addpath.Bat, again
  15. REM To: ts@uwasa.fi
  16. REM Date: Sat, 13 Jan 90 3:35:17 EET DST
  17.  
  18. REM Take care whole path is uppercase
  19. PATH %PATH%
  20. :LOOP
  21. REM Finish if no parameters, or ran out of parameters
  22. IF /%1/==// GOTO EXIT
  23. REM Remember old path, convert new addition to uppercase
  24. SET _ADD=%PATH%
  25. PATH %1
  26. REM Handle special cases of no path set and path same as current parameter
  27. IF /%_ADD%/==/%PATH%/ GOTO SKIP
  28. IF /%_ADD%/==// GOTO SKIP
  29. REM Then figure out if already in current path setting
  30. FOR %%D IN (%_ADD%) DO IF %%D==%PATH% SET PATH=
  31. REM If was not, add it
  32. IF NOT /%PATH%/==// PATH %PATH%;%_ADD%
  33. IF /%PATH%/==// PATH %_ADD%
  34. :SKIP
  35. SHIFT
  36. GOTO LOOP
  37. :EXIT
  38. SET _ADD=
  39. PATH
  40. ECHO.
  41. ECHO ON
  42.  
  43. REM * * * Otto J. Makela (otto@jyu.fi, MAKELA_OTTO_@FINJYU.BITNET) * * * * * * *
  44. REM * Phone: +358 41 613 847, BBS: +358 41 211 562 (CCITT, Bell 2400/1200/300) *
  45. REM * Mail: Kauppakatu 1 B 18, SF-40100 Jyvaskyla, Finland, EUROPE             *
  46. REM * * * freopen("/dev/null","r",stdflame); * * * * * * * * * * * * * * * * * *
  47.